class ScorePanel {
  score: number = 0;
  level: number = 1;
  scoreEl: HTMLElement;
  levelEl: HTMLElement;
  maxLevel: number;
  levelScore:number;
  constructor(maxLevel: number = 10, levelScore:number = 10) {
    this.scoreEl = document.getElementById('score-panel')!;
    this.levelEl = document.getElementById('level-panel')!;
    this.maxLevel = maxLevel;
    this.levelScore = levelScore;
  }
  addScore() {
    this.scoreEl.innerHTML = ++this.score + '';
    if (this.score % 10 === 0) {
      this.levelUp();
    }
  }
  levelUp() {
    if (this.level >= this.maxLevel) {
      this.level = this.maxLevel;
    }
    this.levelEl.innerHTML = ++this.level + '';
  }
}
export default ScorePanel